﻿using System.ComponentModel;
namespace BizControl.Presentation.Infrastructure.Controls.Graph
{
  public class GraphVertex : INotifyPropertyChanged
  {
    public GraphVertex(string id, object data)
    {
      ID = id;
      Data = data;
    }

    public GraphVertex(string id)
      : this (id, null)
    {
    }

    private string _id;
    public string ID
    {
      get
      {
        return _id;
      }
      private set
      {
        _id = value;
        OnPropertyChanged("ID");
      }
    }

    private object _data;
    public object Data
    {
      get
      {
        return _data;
      }
      private set
      {
        _data = value;
        OnPropertyChanged("Data");
      }
    }

    public override string ToString()
    {
      return ID;
    }

    private IGraphViewModel _childModel;
    public IGraphViewModel ChildModel
    {
      get
      {
        return _childModel;
      }
      set
      {
        _childModel = value;
        OnPropertyChanged("ChildModel");
      }
    }


    #region INotifyPropertyChanged Members

    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual void OnPropertyChanged(string propertyName)
    {
      if (PropertyChanged != null)
        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }

    #endregion
  }
}
